﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Errors_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="phHead" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="phSubMenu" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="phActions" Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="phMain" Runat="Server">
    <asp:Panel ID="pnlForm" CssClass="form threeCol" style="border:dashed 1px #037DB8; padding:5px;" runat="server">
        <ul class="col" style="float:left;width:33%">
            <li class="formItem">
                <asp:Label ID="Label3" AssociatedControlID="dtFrom" Text="From:" runat="server" />
                <span class="formInput" style="display:block;">
                    <telerik:RadDateTimePicker ID="dtFrom" runat="server" />
                </span>
            </li>
            <li class="formItem">
                <asp:Label ID="Label2" AssociatedControlID="dtTo" Text="To:" runat="server" />
                <span class="formInput" style="display:block;">
                    <telerik:RadDateTimePicker ID="dtTo" runat="server" />
                </span>
            </li>
        </ul>
        <ul class="col" style="float:left;width:33%">
            <li class="formItem">
                <asp:Label ID="Label1" AssociatedControlID="ddlUrl" Text="Url:" runat="server" />
                <span class="formInput" style="display:block;">
                    <asp:DropDownList ID="ddlUrl" AppendDataBoundItems="true" DataSourceID="dsUrls" runat="server">
                        <asp:ListItem Text="All" Value=""/>
                    </asp:DropDownList>
                </span>
            </li>
            <li class="formItem">
                <asp:Label ID="lblError" AssociatedControlID="ddlErrorType" Text="Error Type:" runat="server" />
                <span class="formInput" style="display:block;">
                    <asp:DropDownList ID="ddlErrorType" DataSourceID="dsErrorTypes" AppendDataBoundItems="true" runat="server">
                        <asp:ListItem Text="All"  Value=""/>
                    </asp:DropDownList>
                </span>
            </li>
        </ul>
        <ul class=" col"style="float:left;width:33%">
            <li class="formItem">
                <acms:ActionButton ID="btnSearch" Icon="Ready" Text="Search" OnClick="btnSearch_Click" runat="server" />
            </li>
        </ul>
        <div class="clearBoth"></div>
    </asp:Panel>
    <telerik:RadGrid ID="grid" DataSourceID="dsErrors" AllowPaging="true" PageSize="20" AutoGenerateColumns="false" OnItemCommand="grid_ItemCommand" AllowCustomPaging="true" runat="server">
        <MasterTableView>
            <Columns>
                <telerik:GridBoundColumn HeaderText="Date" DataField="Created" />
                <telerik:GridBoundColumn HeaderText="Url" DataField="Url" />
                <telerik:GridBoundColumn HeaderText="Acms Url" DataField="AcmsUrl" />
                <telerik:GridBoundColumn HeaderText="Exception Type" DataField="ExceptionType" />
                <telerik:GridBoundColumn HeaderText="Exception Message" DataField="ExceptionMessage" />
                <telerik:GridTemplateColumn>
                    <ItemTemplate>
                        <acms:ActionButton ID="btn" Text="Details" CommandName="Details" Icon="Ready" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    <asp:Panel ID="pnlDetailsCommand" CssClass="actionButtons clearfix" Visible="false" runat="server">
        <div class="floatRight">
            <acms:ActionButton ID="btnDetailsBack" Icon="Cancel" Text="Back" OnClick="btnDetailsBack_Click" runat="server" />
        </div>
    </asp:Panel>
    <asp:DetailsView ID="details" DataSourceID="dsErrors" AutoGenerateRows="false" Visible="false" runat="server">
        <Fields>
            <asp:BoundField HeaderText="Date" DataField="Created" />
            <asp:BoundField HeaderText="Url" DataField="Url" />
            <asp:BoundField HeaderText="Acms Url" DataField="AcmsUrl" />
            <asp:BoundField HeaderText="Querystring" DataField="Querystring" />
            <asp:TemplateField HeaderText="Link">
                <ItemTemplate>
                    <asp:HyperLink Id="lnk" runat="server" OnDataBinding="lnk_DataBinding" Target="_blank" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField HeaderText="Referer" DataField="Referer" />
            <asp:TemplateField HeaderText="User">
                <ItemTemplate>
                    <asp:HyperLink ID="lnkUser" runat="server" Text='<%#Eval("UserName")%>' Visible='<%#((int?)Eval("UserId")).HasValue %>' NavigateUrl='<%#Eval("UserId", "~/Users/Details.aspx?Id={0}") %>'/>
                    <asp:Label ID="lblUser" runat="server" Text='<%#Eval("UserName")%>' Visible='<%#!((int?)Eval("UserId")).HasValue %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField HeaderText="Exception Type" DataField="ExceptionType" />
            <asp:BoundField HeaderText="Exception Message" DataField="ExceptionMessage" />
            <asp:TemplateField HeaderText="Stack Trace">
                <ItemTemplate>
                    <%#((string)Eval("StackTrace")).Replace("\n", "<br/>") %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Form">
                <ItemTemplate>
                    <%#System.Web.HttpUtility.UrlDecode(((string)Eval("Form")).Replace("&", "<br/>"))%>
                </ItemTemplate>
            </asp:TemplateField>
        </Fields>
    </asp:DetailsView>
    <acms:EventDrivenDataSource ID="dsErrors" OnSelect="dsErrors_Select" runat="server" />
    <acms:EventDrivenDataSource ID="dsErrorTypes" OnSelect="dsErrorTypes_Select" runat="server" />
    <acms:EventDrivenDataSource ID="dsUrls" OnSelect="dsUrls_Select" runat="server" />
</asp:Content>

